Skip to content

Conversation

@Lamparter
Copy link

No description provided.

@Arlodotexe Arlodotexe self-requested a review April 14, 2025 13:21
@Arlodotexe Arlodotexe added the documentation 📃 Improvements or additions to documentation label Apr 14, 2025
public DependencyPropertyGeneratorCustomSample()
{
this.InitializeComponent();
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be great to see this expanded to use the generator here in the code-behind, and then see that property bound in the XAML.

@hawkerm
Copy link

hawkerm commented Oct 23, 2025

I know Sergio's been busy to review, and I didn't see movement on the comment. I wanted to do some tinkering in this space, so I did a pass on the doc and integrating the sample into it within the sample app with a NumberBox control.

However, I the generator isn't running within the samples project to provide the implementation of the property:

image

The attribute is found, I can see the project dependency, but either the generator doesn't appear to even be running:

image

Rebased this branch on main with my non-working change here: https://github.com/hawkerm/Labs-Windows/tree/dp-generator-docs - I think once the generator runs, it should be fine?

@hawkerm
Copy link

hawkerm commented Oct 24, 2025

I tried checking out a clean main and I actually still can't build the DependencyPropertyGenerator project (in stand-alone component mode, default wasdk setup). I get a bunch of nuget errors like:

1>I:\oss\Labs-Windows\components\DependencyPropertyGenerator\CommunityToolkit.DependencyPropertyGenerator.Tests\CommunityToolkit.DependencyPropertyGenerator.Tests.csproj : error NU1201: Project CommunityToolkit.Labs.WinUI.DependencyPropertyGenerator is not compatible with net8.0-windows10.0.17763 (.NETCoreApp,Version=v8.0). Project CommunityToolkit.Labs.WinUI.DependencyPropertyGenerator supports:
1>I:\oss\Labs-Windows\components\DependencyPropertyGenerator\CommunityToolkit.DependencyPropertyGenerator.Tests\CommunityToolkit.DependencyPropertyGenerator.Tests.csproj : error NU1201:   - net8.0-windows10.0.19041 (.NETCoreApp,Version=v8.0)
1>I:\oss\Labs-Windows\components\DependencyPropertyGenerator\CommunityToolkit.DependencyPropertyGenerator.Tests\CommunityToolkit.DependencyPropertyGenerator.Tests.csproj : error NU1201:   - net9.0-windows10.0.19041 (.NETCoreApp,Version=v9.0)

And these generator errors:

3>I:\oss\Labs-Windows\tooling\CommunityToolkit.App.Shared\AppLoadingView.xaml.cs(113,16,113,39): error CS0103: The name 'ToolkitDocumentRegistry' does not exist in the current context
3>I:\oss\Labs-Windows\tooling\CommunityToolkit.App.Shared\AppLoadingView.xaml.cs(118,16,118,37): error CS0103: The name 'ToolkitSampleRegistry' does not exist in the current context
3>I:\oss\Labs-Windows\tooling\CommunityToolkit.App.Shared\Renderers\ToolkitDocumentationRenderer.xaml.cs(111,29,111,50): error CS0103: The name 'ToolkitSampleRegistry' does not exist in the current context
3>I:\oss\Labs-Windows\tooling\CommunityToolkit.App.Shared\Renderers\ToolkitDocumentationRenderer.xaml.cs(131,36,131,57): error CS0103: The name 'ToolkitSampleRegistry' does not exist in the current context
3>Done building project "DependencyPropertyGenerator.Wasdk.csproj" -- FAILED.

Binlogs: binlogs.zip
VS: 17.14.17

I:\oss\Labs-Windows>msbuild --version
MSBuild version 17.14.23+b0019275e for .NET Framework
17.14.23.42201

I was able to build and run the all components solution... I'll check if the branch works as well, but was confused by the stand-alone component not building for the faster dev loop. (I did notice that opening the all solution changed my multi-targets to include more, including a netstandard one, does that need to be in the default targets list for the generator projects to work?)

Branch still has issue with analyzer not running, I think it's because the samples project just references the src project as a regular project from the standard props file for samples vs. including it as an analyzer type. Trying to add both may be causing a conflict now...

@hawkerm
Copy link

hawkerm commented Oct 24, 2025

image

I still get lots of weird TFM errors from nuget... these seem ignorable at the moment.

I was thinking trying to add the netstandard target to the multitargets would help, but when I run the single component OpenSolution.bat it resets the multitargets to wasdk and wasm... I can't override that it seems?

Looks like GenerateSingleSolution.ps1 and GenerateSingleSampleHeads.ps1 are missing netstandard as an option, so it can't be added at the end of the OpenSolution.bat for the DependencyPropertyGenerator component? -MultiTargets wasdk, netstandard

But as mentioned, that didn't actually help, removing the auto-added src project from ToolkitComponent.SampleProject.props and adding it to the samples Dependencies.props as an analyzer:

    <ItemGroup>
      <ProjectReference Include="..\src\CommunityToolkit.WinUI.DependencyPropertyGenerator.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="True" />  
    </ItemGroup>

Seemed to resolve the triangle warning of the duplicate reference, AND I see it in the analyzer list now, but it's not running still:

image

Like it's not even saying it's not generating files...

It'd be really nice to show a working embedded sample in the sample app for this stuff.

I can try adding a special prop for the samples config about excluding the src project and then see if I can try in the all solution again where I'm not seeing the other problems with the dependency property project tfms at least...? Otherwise, I'm not sure what else to do here to get this to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation 📃 Improvements or additions to documentation

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

4 participants